package ReflectionTest;

// 代理模式的接口
interface ClothFactory {
    void produceCloth();
}

// 代理模式的实现类
class NikeClothFactory implements ClothFactory {
    @Override
    public void produceCloth() {
        System.out.println("Nike produces clothes.");
    }
}

// 代理模式的代理类
class ProxyClothFactory implements ClothFactory {
    private ClothFactory factory;

    public ProxyClothFactory(ClothFactory factory) {
        this.factory = factory;
    }

    @Override
    public void produceCloth() {
        System.out.println("Proxy starts.");
        factory.produceCloth();
        System.out.println("Proxy ends.");
    }
}

public class staticProxy {
    public static void main(String[] args) {
        NikeClothFactory nike = new NikeClothFactory();
        ProxyClothFactory proxy = new ProxyClothFactory(nike);
        proxy.produceCloth();
    }
}
